<template>
  <transition name="el-drawer-fade">
    <div
      class="nav-manager"
      :style="{ 'z-index': zIndex, left: containerLeft }"
    >
      <div class="nav-manager__content">
        <div class="nav-section">
          <div class="nav-section__title" title="123123">全部应用</div>
          <flexbox class="nav-section__content" wrap="wrap">
            <div
              class="nav-section-item"
              v-for="(item, index) in subapps"
              :key="index" :index="item.path"
              @click="selectClick(item)"
            >
              <div class="nav-section-item__icon">
                <svg-icon class="svg-icon" :icon-class="item.icon" />
              </div>
              <div class="nav-section-item__label">{{ item.name }}</div>
            </div>
          </flexbox>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
import { PopupManager } from "element-ui/lib/utils/popup";
export default {
  // 模块管理
  name: "MoreApp",
  components: {},
  props: {
    collapse: Boolean,
    topModule: Array,
    subapps: Array
  },
  data() {
    return {
      zIndex: PopupManager.nextZIndex(),
      loading: false,
      isEdit: false,
      topList: [],
      allList: [],
    };
  },
  computed: {
    containerLeft() {
      if (this.collapse) {
        return "79px";
      }
      return "235px";
    },
  },
  methods: {
    selectClick(item){
      this.$emit('select', item.path)
    }
  },
};
</script>

<style lang="scss" scoped>
.nav-manager {
  line-height: 10px;
  position: absolute;
  top: 61px;
  right: 15px;
  background-color: white;
  box-shadow: 0px 8px 11px 1px rgba(0, 0, 0, 0.1);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  padding: 20px 15px 40px;
  &__content {
    position: relative;
  }
  &__handle {
    position: absolute;
    right: 20px;
    top: -5px;
  }
  .nav-section {
    &__title {
      font-weight: bold;
    }
    &__tips {
      color: #ccc;
      font-weight: normal;
    }
    &__content {
      margin-top: 20px;
    }
  }
  .nav-section + .nav-section {
    margin-top: 20px;
    border-top: 1px solid #bbb;
    .nav-section__title {
      margin-top: 20px;
    }
  }
  .nav-section-item {
    text-align: center;
    width: 70px;
    height: 70px;
    margin: 10px;
    cursor: pointer;
    position: relative;
    &__icon {
      width: 40px;
      height: 40px;
      display: inline-block;
      line-height: 40px;
      border-radius: 4px;
      background-color: #F0F0F0;
      border-radius: 4px;
      .svg-icon {
        font-size: 18px;
        color: #2362FB;
      }
    }
    &__label {
      font-size: 13px;
      margin-top: 10px;
    }
    .el-icon-circle-plus,
    .el-icon-remove {
      color: #F94E4E;
      cursor: pointer;
    }
    .is-handle {
      position: absolute;
      right: 10px;
      top: -6px;
    }
    .span-future {
      position: absolute;
      top: -6px;
      left: 35px;
      font-size: 12px;
      background: #D9D9D9;
      display: inline-block;
      color: white;
      padding: 2px 3px;
      border-radius: 2px;
      white-space: nowrap;
      transform: scale(0.9);
    }
    &.is-future {
      cursor: initial;
      .nav-section-item__icon {
        i {
          color: #999;
        }
      }
      .nav-section-item__label {
        color: #666;
      }
    }
  }
}
</style>